#include <REGX51.H>
#include "DS1302.H"

extern unsigned char DS1302_Time[];

void Delay(unsigned int xms)
{
	unsigned char i, j;
	while(xms--)
	{
		i = 2;
		j = 239;
		do
		{
			while (--j);
		} while (--i);
	}
}
void SG(int a,int b)
{
	unsigned char Tab[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
  unsigned char Count[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
	P2=Count[a];
	P0=~Tab[b];
	Delay(4);
}
void main()
{
	unsigned char time_buf[9];
	DS1302_Init();

	while(1)
	{
			    DS1302_ReadTime();
					SG(0,DS1302_Time[0]/10);
					SG(1,DS1302_Time[0]%10);
	}
}

